package com.heyue.demo.thread.method;

/**
 * @author fenghe
 * @date 2022/2/13 9:10
 */
public class MyThread extends Thread {
    private static int count;
    @Override
    public void run() {
        while (true) {
            for (int i = 0; i < 10; i++) {
                System.out.println("hi  " + i);
                try {
                    Thread.sleep(1000);
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
            }
            break;
        }
    }
}
class Thread01 {
    public static void main(String[] args) throws InterruptedException {
        MyThread myThread = new MyThread();
        System.out.println(myThread.getName() + "： 状态：" + myThread.getState());
        myThread.start();

        while (Thread.State.TERMINATED != myThread.getState()) {
            System.out.println(myThread.getName() + "： 状态：" + myThread.getState());
            Thread.sleep(500);
        }

        System.out.println(myThread.getName() + "： 状态：" + myThread.getState());
    }
}
